part of 'component.dart';

PreferredSizeWidget detailAppBar(
  BuildContext context, {
  String? title,
  Color? titleColor,
  Color? leadingColor = Colors.black54,
  Color? backgroundColor,
  double elevation = 0.2,
  List<Widget>? actions,
  Widget? leadding,
  double? leadingWidth,
  VoidCallback? backTap,
  PreferredSizeWidget? bottom,
}) {
  return AppBar(
    elevation: elevation,
    centerTitle: true,
    backgroundColor: backgroundColor ?? Colors.white,
    title: Text(
      title ?? '',
      style: TextStyle(color: titleColor ?? TopColors.black_33, fontSize: 18.sp),
    ),
    leadingWidth: leadingWidth,
    leading: leadding ??
        navBarBackBtn(
          context,
          leadingColor: leadingColor,
          callback: backTap,
        ),
    actions: actions,
    bottom: bottom,
  );
}

AppBar presentAppBar(BuildContext context,
    {String? title,
    Color? titleColor,
    Color? backgroundColor,
    Color leadingColor = Colors.black87,
    VoidCallback? callback,
    List<Widget>? actions}) {
  return AppBar(
    backgroundColor: backgroundColor ?? Colors.white,
    leading: IconButton(
      icon: Icon(
        Icons.arrow_back_ios,
        size: 20.w,
        color: leadingColor,
      ),
      onPressed: () {
        if (callback != null) {
          callback();
        } else {
          Get.back();
        }
      },
    ),
    elevation: 0,
  );
}

Widget navBarBackBtn(
  BuildContext context, {
  Color? leadingColor = Colors.black87,
  VoidCallback? callback,
}) {
  return IconButton(
    onPressed: () {
      if (callback != null) {
        callback();
      } else {
        Get.back();
      }
    },
    icon: Icon(
      Icons.arrow_back_ios_new_outlined,
      color: leadingColor,
    ),
  );
}
